
/**
 * Represent a die that can be rolled.
 * 
 * @author (Mj Park) 
 * @version September 16, 2013
 */
import java.util.Random;

public class die
{
    Random ran = new Random();
    // instance variables 
    private int MIN_SIDES = 4;
    private int sides, result;

    /**
     * Constructor for objects of class die
     */
    public die()
    {
        sides = 6;
        this.roll();
    }
   
    public die(int s)
    {
        if(s >= MIN_SIDES) 
        {
               sides = s;    
               roll();
    }
    else
    {
        sides = 6;
        System.out.println("Your die has 6 sides.");
        roll();
    }
}
    public int roll()
    { 
        result = ran.nextInt(sides+1)+1;
        return result;
    }
    public int getResult()
    {
        return result;
    }
    public int getSides()
    {
         return sides;
        }
    public void setSides(int y)
    {
        sides = y;
    }
}
